<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>移动端事件</title>
    <style>
        *{margin: 0;padding:0;box-sizing: border-box}
        #banner{
            width: 100%;
            height: 300px;
            border:solid 1px #666;
            color: rgb(46, 105, 214);
        }

        #box{
            width: 200px;
            height: 200px;
            border:solid 1px #000;
        }

    </style>
</head>
<body>
    <div id="banner"></div>

    <div id="box"></div>

    <script>
        //获取元素
        let banner = document.querySelector("#banner");
        let box = document.querySelector("#box");

        //绑定事件
        banner.addEventListener('touchstart', function(){
            banner.style.background = 'rgb(218, 31, 31)';
        });

        banner.addEventListener('touchmove', function(){
            console.log('move move move')
            banner.style.background = 'rgb(203, 214, 45)';
        });

        banner.addEventListener('touchend', function(){
            console.log('end end end')
            banner.style.background = 'rgb(46, 105, 214)';
        });

        //cancel 取消          cancel   OK
        banner.addEventListener('touchcancel', function(){
            console.log('触摸被打断啦!!!');
        });

        setTimeout(() => {
            alert('今天天气真不错!!');
        }, 3000)


        box.addEventListener('mousemove', function(){
            console.log(123);
        })
    </script>
</body>
</html>